#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) 61DUke.

# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Readme Document for more details.
# Create: 2020-12-27

import os


def get_file_paths(extension, folder_path):
    """
    Get all py files under this path
    :param extension:
    :param folder_path:
    :return: generator
    """
    for base_path, dir_names, file_names in os.walk(folder_path):
        for real_path in [
            os.path.join(base_path, p).replace("\\", "/")
            for p in dir_names + file_names
            if extension in p
        ]:
            if real_path:
                yield real_path
